package com.quasar.hpatient.module.discover;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;

import com.quasar.hpatient.R;

import lib.quasar.base.frame.BaseFragment;
import lib.quasar.widget.tab.TextTabLayout;

/**
 * description: 发现
 * created by kalu on 2018/4/2 16:12
 */
public class DiscoverFragment extends BaseFragment<DiscoverPresenter> implements DiscoverView {

    @Override
    public int initView() {
        return R.layout.fragment_discover;
    }

    @Override
    public void initDataLocal() {

        getPresenter().initLayoutData(this, getFragmentManager());
    }

    @Override
    public void setPagerAdapter(PagerAdapter adapter) {

        if (null == getView()) return;
        ViewPager pager = getView().findViewById(R.id.fragment_discover_pager);
        if (null == pager) return;
        pager.setOffscreenPageLimit(1);
        pager.setAdapter(adapter);
    }

    @Override
    public void setMenuPager() {

        if (null == getView()) return;
        TextTabLayout menu = getView().findViewById(R.id.fragment_discover_menu);
        if (null == menu) return;
        ViewPager pager = getView().findViewById(R.id.fragment_discover_pager);
        if (null == pager) return;
        menu.setViewPager(pager);
    }
}